//
//  Global.swift
//  NewXueBa
//
//  Created by Shine on 2019/5/30.
//  Copyright © 2019 jmxQAQ. All rights reserved.
//

import Foundation
//屏幕宽高
let kScreenWidth = UIScreen.main.bounds.width
let kScreenHeight = UIScreen.main.bounds.height
//是否是 isIphoneX
let isIphoneX =  kScreenHeight >= 812 ? true : false
// 导航栏和tabBar 的高度
let bcNavBarHeight: CGFloat = isIphoneX ? 88 : 64
let bcTabBarHeight: CGFloat = isIphoneX ? 83 : 49

let bcTopBarHeight: CGFloat = isIphoneX ? 44 : 20
let bcBottomBarHeight: CGFloat = isIphoneX ? 34 : 0

let BC_Ver = "1.0.3.2" // 客户端版本号
let BC_Ctype = "30" // 客户端类型
var Gloab_Connect_Device: RobotPenDevice? //连接的设备

//当前的视图
var topVC: UIViewController? {
    var resultVC: UIViewController?
    resultVC = _topVC(UIApplication.shared.keyWindow?.rootViewController)
    while resultVC?.presentedViewController != nil {
        resultVC = _topVC(resultVC?.presentedViewController)
    }
    return resultVC
}

private  func _topVC(_ vc: UIViewController?) -> UIViewController? {
    if vc is UINavigationController {
        return _topVC((vc as? UINavigationController)?.topViewController)
    } else if vc is UITabBarController {
        return _topVC((vc as? UITabBarController)?.selectedViewController)
    } else {
        return vc
    }
}


